package com.ec.common.utils;

import eu.bitwalker.useragentutils.UserAgent;

import javax.servlet.http.HttpServletRequest;

public class UserAgentUtils {

    public static UserAgent getUserAgent() {
        // 获取 http 请求类
        HttpServletRequest httpServletRequest = ServletUtils.getRequest();
        // 获取客户端信息
        String header = httpServletRequest.getHeader("User-Agent");
        // 解析客户端信息
        return UserAgent.parseUserAgentString(header);
    }
}
